package com.biglead.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biglead.demo.common.PageRequest;
import com.biglead.demo.common.PageUtils;
import com.biglead.demo.pojo.UserCategory;
import com.biglead.demo.mapper.UserCategoryMapper;
import com.biglead.demo.service.IUserCategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.catalina.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 用户分类表 服务实现类
 * </p>
 *
 * @author 早起的年轻人
 * @since 2023-03-14
 */
@Service("userCategoryService")
public class UserCategoryServiceImpl extends ServiceImpl<UserCategoryMapper, UserCategory> implements IUserCategoryService {

    @Resource
    UserCategoryMapper userCategoryMapper;
    @Override
    public Object findPage(Integer index, Integer pageSize){

        UserCategory userCategory = userCategoryMapper.selectById(1);
        Page<UserCategory> page = Page.of(index,pageSize);

        //queryWrapper组装查询where条件
        LambdaQueryWrapper<UserCategory> queryWrapper = new LambdaQueryWrapper<>();
        //查询条件 ID = 1 的数据
        queryWrapper.eq(UserCategory::getId,1);
        //发起查询
        userCategoryMapper.selectPage(page,queryWrapper);
        return page;
    }
}
